# Author:Suiqiao
import requests,json

def geo(key,address,city=None,batch='false',sig=None,output='json',callback=None):
    ##获取的Api的地理编码信息
    url='https://restapi.amap.com/v3/geocode/geo?parameters'
    params={
    'key':key,
    'address':address,
    'city':city,
    'batch':batch,
    'sig':sig,
    'output':output,
    'callback':callback
    }
    response=requests.get(url,params=params)
    results=response.json()['geocodes'][0]['location']
    # return
    return results

# 步行路径规划
def walking(key,origin,location,sig=None,output='json',callback=None):
    ##步行路径规划
    url='https://restapi.amap.com/v3/direction/walking?parameters'
    params={
        'key':key,
        'origin':origin,
        'destination':location,
        'sig':sig,
        'output':output,
        'callback':callback,     
    }
    response=requests.get(url,params)
    results=response.json()
    # return
    return results
